<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.min.js"></script>
    <script src="./js/axios.min.js"></script>
</head>

<body>
    <input type="button" value="get请求" id="get">
    <input type="button" value="post请求" id="post">
</body>
<script>
    /* 
        请求地址:https://autumnfish.cn/api/joke/list 
        请求方法:get 
        请求参数:num(笑话条数,数字) 
        响应内容:随机笑话 
        */
    document.getElementById("get").onclick = function() {
            axios.get("https://autumnfish.cn/api/joke/list?num=2").then(function(response) {
                    console.log(response);
                },
                function(error) {
                    console.log(error);
                })
        }
        /* 
        请求地址:https://autumnfish.cn/api/user/reg 
        请求方法:post  
        请求参数:username(用户名,字符串) 
        响应内容:注册成功或失败
        */
    document.getElementById("post").onclick = function() {
        axios.post("https://autumnfish.cn/api/user/reg", {
            username: "张三"
        }).then(function(response) {
                console.log(response);
            },
            function(error) {
                console.log(error);
            })
    }
</script>

</html>